package com.lqr.wechat.activity;

import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import com.lqr.wechat.R;
import com.lqr.wechat.databinding.ActivityCardPacketBinding;

/**
 * @创建者 CSDN_LQR
 * @描述 卡包
 */
public class CardPaketActivity extends BaseActivity {
    private ActivityCardPacketBinding binding ;

    @Override
    protected int layoutId() {
        return R.layout.activity_card_packet;
    }

    @Override
    public void initView() {
        binding = getBind() ;
        initToolbar();
    }

    @Override
    public void initListener() {
        binding.cvVipCard.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CardPaketActivity.this, VipCardActivity.class));
            }
        });
        binding.cvFriendsCoupon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CardPaketActivity.this, FriendsCouponActivity.class));
            }
        });
        binding.cvMyCoupon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CardPaketActivity.this, MyCouponActivity.class));
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        new MenuInflater(this).inflate(R.menu.menu_one_text, menu);
        menu.getItem(0).setTitle("消息通知");
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();
        if (itemId == android.R.id.home) {
            finish();
        } else if (itemId == R.id.itemOne) {
            startActivity(new Intent(this, MsgNotificationActivity.class));
        }
        return super.onOptionsItemSelected(item);
    }

    private void initToolbar() {
        setSupportActionBar(binding.lyToolbar.toolbar);
        getSupportActionBar().setTitle("卡包");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        binding.lyToolbar.toolbar.setNavigationIcon(R.mipmap.ic_back);
    }
}